Interacting using the command line


Introduction to Bioinformatics - Module 2

Nina Norgren

Interacting (mkdir)

  • mkdir - make directory
    • Create new folder from current position
mkdir <name of new folder>


No blanks in folder names!

Interacting (rmdir)

  • rmdir - remove empty directory
rmdir <name of directory>


Interacting (cp)

  • cp - copy a file
cp <name of original> <name of copy>


Interacting (cp)

  • cp - copy a file
cp <name of original> <name of copy>



Never use blanks in your folder/file names!

Interacting (cp)

  • cp - copy a file


cp <name of original> <name of copy>
cp copied_file analysis/

Interacting (cp)

  • cp - copy a file
cp <name of original> <name of copy>
cd analysis/
cp copied_file ../data/raw_data

Interacting (cp)

  • cp - copy a file

Linux never asks before overwriting existing files!

Interacting (mv)

  • mv - move a file
mv <name of the file> <name of the “copy”>
mv ../copied_file .


Notice! the . denotes the current location

Interacting (mv)

  • mv - rename a file
mv <name of the file> <name of the “copy”>
mv copied_file my_renamed_file


Interacting (rm)

  • rm - remove a file
rm <name of the file>
rm copied_file


Interacting (rm)

  • rm - remove a file
rm <name of the file>
rm ../original_file


Interacting (rm)

  • rm - remove a file
rm <name of the file>


There is NO trash bin in CLI! Gone is gone!

Interacting (*)

  • * - wildcards
    • Works on most linux commands
ls -l *.txt


Interacting (*)

  • * - wildcards
    • Works on most linux commands
cp *.txt myfolder/
rm *.txt

Summary

  • mkdir - make a new directory
  • rmdir - remove empty directory
  • cp - copy file from one location to another
  • mv - move/rename file
  • rm - remove file
  • * - wildcard to match several files